package com.justgame.project.base.interceptor;

import com.justgame.project.cloud.common.constant.Const;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 请求拦截器，操作Request
 */
@Component
public class HttpRequestInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //request方式
        request.setAttribute(Const.REQUEST_START_TIME, System.currentTimeMillis());
        return true;
    }
}
